﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Reflection;
using System.Windows.Forms;
using ESRI.ArcGIS.ADF.BaseClasses;
using ZJGIS.CartoGraphy;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.Geometry;
using Point = System.Drawing.Point;
using ZJGIS.Framework;

namespace ZJGIS.CartoGraphy
{
    class PrintBySmallScale : BaseCommand
    {
        IApplication m_Application = null;
        public PrintBySmallScale()
        {
            base.m_caption = "小比例尺制图";
            base.m_toolTip = base.m_caption;
        }

        public override void OnCreate(object hook)
        {
            m_Application = hook as IApplication;
        }

        public override void OnClick()
        {
            FrmMapframe frmMapframe = FrmMapframe.CreateInstance();
            frmMapframe.Application = m_Application;       
            frmMapframe.Show((m_Application as IFramework).MdiForm);
        }

        public override int Bitmap
        {
            get
            {
                string bitmapResourceName = this.GetType().Namespace + ".Res." + this.GetType().Name + ".png";
                System.IO.Stream stream = GetType().Assembly.GetManifestResourceStream(bitmapResourceName);
                if (stream == null) return;
                return new Bitmap(stream).GetHbitmap().ToInt32();
            }
        }
        public override bool Enabled
        {
            get
            {
                return true;
                //return (m_Application as IFramework).IsMapCtrlactive;
            }
        }
    }
}
